'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 shademode
.ds Xs 4246 5 shademodel.gl
.TH GLSHADEMODEL 3G
.SH NAME
.B "glShadeModel
\- select flat or smooth shading

.SH C SPECIFICATION
void \f3glShadeModel\fP(
GLenum \fImode\fP )
.nf
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2mode\fP\ \ 'u 
\f2mode\fP
Specifies a symbolic value representing a shading technique.
Accepted values are \%\f3GL_FLAT\fP and \%\f3GL_SMOOTH\fP.
The initial value is \%\f3GL_SMOOTH\fP.
.SH DESCRIPTION
GL primitives can have either flat or smooth shading.
Smooth shading,
the default,
causes the computed colors of vertices to be interpolated as the
primitive is rasterized,
typically assigning different colors to each resulting pixel fragment.
Flat shading selects the computed color of just one vertex
and assigns it to all the pixel fragments
generated by rasterizing a single primitive.
In either case, the computed color of a vertex is the result of
lighting if lighting is enabled,
or it is the current color at the time the vertex was specified if
lighting is disabled. 
.P
Flat and smooth shading are indistinguishable for points.
Starting when \%\f3glBegin\fP is issued and counting vertices and
primitives from 1, the GL gives each flat-shaded line segment $i$ the
computed color of vertex $i ~+~ 1$, its second vertex.
Counting similarly from 1,
the GL gives each flat-shaded polygon the computed color of the vertex listed
in the following table.
This is the last vertex to specify the polygon in all cases except single
polygons,
where the first vertex specifies the flat-shaded color.
.sp
.TS
center;
lb cb
l c .
_
Primitive Type of Polygon $i$	Vertex
_
Single polygon ($ i ~==~ 1 $)	1
Triangle strip	$i ~+~ 2$
Triangle fan	$i ~+~ 2$
Independent triangle	$ 3 i$
Quad strip	$2 i ~+~ 2$
Independent quad 	$ 4 i $
_
.TE
.sp
Flat and smooth shading are specified by \%\f3glShadeModel\fP with \f2mode\fP set to
\%\f3GL_FLAT\fP and \%\f3GL_SMOOTH\fP, respectively.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2mode\fP is any value other than
\%\f3GL_FLAT\fP or \%\f3GL_SMOOTH\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glShadeModel\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_SHADE_MODEL\fP
.SH SEE ALSO
\%\f3glBegin(3G)\fP,
\%\f3glColor(3G)\fP,
\%\f3glLight(3G)\fP,
\%\f3glLightModel(3G)\fP
